struct User{
    username:String,
    email:String,
    sign_in_count:u64,
    active:bool,
}

// fn main() {
//     let user1 = User{
//         email: String::from("Someone@example.com"),
//         username:String::from("someusername123"),
//         active:true,
//         sign_in_count:1,
//     };
//     println!("{:?}",user1.email);
//     user1.email = String::from("anotheremail@example.com");

//     println!("{:?}",user1.email);
// }

fn build_user(email:String,username:String) -> User{
    User{
        email:email,
        username:username,
        active:true,
        sign_in_count:1,
    }
}

fn build_user1(email:String,username:String) ->User{
    User{
        email,
        username,
        active:true,
        sign_in_count:1
    }
}
fn main() {
    let user1 = User{
        email: String::from("Someone@example.com"),
        username:String::from("someusername123"),
        active:true,
        sign_in_count:1,
    };
    
    let user2 = User{
        email:String::from("another@example.com"),
        username:String::from("anotherusername456"),
        active:user1.active,
        sign_in_count:user1.sign_in_count,
    };
    
    let user21 = User{
        email:String::from("another@example.com"),
        username:String::from("anotherusername456"),
        ..user1
    };
}

//使用没有名字字段的元组结构体来创建不同的类型
struct Color(i32,i32,i32);
struct Ponint(i32,i32,i32);

let black = Color(0,0,0);
let origin= Ponint(0,0,0);











